package com.ude.pim.controller;

import com.ude.pim.common.R;
import com.ude.pim.dto.CaseSubDelayApplyDTO;
import com.ude.pim.entity.CaseSubDelayApply;
import com.ude.pim.service.CaseSubDelayApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yb
 * @since 2023-08-21
 */
@RestController
@RequestMapping("/caseSubDelayApply")
public class CaseSubDelayApplyController {

    @Autowired
    private CaseSubDelayApplyService caseSubDelayApplyService;

    @PostMapping
    public R<String> save(@RequestBody CaseSubDelayApply caseSubDelayApply){
        return caseSubDelayApplyService.saveWithCheck(caseSubDelayApply);
    }

    @GetMapping("/checkList")
    public R<List<CaseSubDelayApplyDTO>> checkingList(){
        return caseSubDelayApplyService.checkingList();
    }

    @PutMapping("/judgeApply")
    public R<String> judge(@RequestBody CaseSubDelayApplyDTO caseSubDelayApplyDTO){
        return caseSubDelayApplyService.judge(caseSubDelayApplyDTO);
    }

    @PostMapping("/byUserAndStatus")
    public R<List<CaseSubDelayApplyDTO>> getByUserAndStatus(@RequestBody CaseSubDelayApply caseSubDelayApply){
        return caseSubDelayApplyService.getByUserAndStatus(caseSubDelayApply);
    }

}
